package com.wang.wx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wang.wx.mapper.LyUserMapper;
import com.wang.wx.entity.LyUser;
import com.wang.wx.service.LyUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 领英用户表(LyUser)表服务实现类
 *
 * @author makejava
 * @since 2024-08-06 13:38:34
 */
@Slf4j
@Service
public class LyUserServiceImpl extends ServiceImpl<LyUserMapper, LyUser> implements LyUserService {

    @Override
    public void createIndexes() {
        log.info("领英索引创建中");
        baseMapper.createIndexes();
        log.info("领英索引创建成功");
    }

    public void dropIndexes() {
        baseMapper.dropIndexes();
        log.info("领英索引删除成功");
    }

    @Override
    public List<LyUser> getByPhone(String phone) {
        LambdaQueryWrapper<LyUser> wrapper = new LambdaQueryWrapper<>();
        wrapper.likeRight(LyUser::getPhoneNumbers, phone);
        return this.list(wrapper);
    }

    @Override
    public List<LyUser> getByEmail(String email) {
        LambdaQueryWrapper<LyUser> wrapper = new LambdaQueryWrapper<>();
        wrapper.likeRight(LyUser::getEmails, email);
        return this.list(wrapper);
    }
}

